Option Strict On
Option Explicit On 
Imports System
Imports System.Object

Public Class frmXMLchangeStyle
    Inherits System.Windows.Forms.Form
    Public Shared strNewHref As String = ""
    Friend WithEvents ToolTip1 As System.Windows.Forms.ToolTip
    Public Shared strOldHref As String = ""


#Region " Windows Form Designer generated code "

    Public Sub New(ByVal strHrefIn As String)
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        strOldHref = strHrefIn

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents txtOldStyle As System.Windows.Forms.TextBox
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Panel1 As System.Windows.Forms.Panel
    Friend WithEvents rdoNone As System.Windows.Forms.RadioButton
    Friend WithEvents rdoChange As System.Windows.Forms.RadioButton
    Friend WithEvents txtNewStyle As System.Windows.Forms.TextBox
    Friend WithEvents btnOK As System.Windows.Forms.Button
    Friend WithEvents btnCancel As System.Windows.Forms.Button
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents btnBrowse As System.Windows.Forms.Button
    Friend WithEvents OpenFileDialog1 As System.Windows.Forms.OpenFileDialog
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.components = New System.ComponentModel.Container
        Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(frmXMLchangeStyle))
        Me.Label1 = New System.Windows.Forms.Label
        Me.txtOldStyle = New System.Windows.Forms.TextBox
        Me.Label2 = New System.Windows.Forms.Label
        Me.Panel1 = New System.Windows.Forms.Panel
        Me.btnBrowse = New System.Windows.Forms.Button
        Me.Label3 = New System.Windows.Forms.Label
        Me.txtNewStyle = New System.Windows.Forms.TextBox
        Me.rdoChange = New System.Windows.Forms.RadioButton
        Me.rdoNone = New System.Windows.Forms.RadioButton
        Me.OpenFileDialog1 = New System.Windows.Forms.OpenFileDialog
        Me.btnOK = New System.Windows.Forms.Button
        Me.btnCancel = New System.Windows.Forms.Button
        Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
        Me.Panel1.SuspendLayout()
        Me.SuspendLayout()
        '
        'Label1
        '
        Me.Label1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.Location = New System.Drawing.Point(12, 9)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(176, 23)
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "The current stylesheet URL is:"
        '
        'txtOldStyle
        '
        Me.txtOldStyle.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtOldStyle.Location = New System.Drawing.Point(187, 6)
        Me.txtOldStyle.Name = "txtOldStyle"
        Me.txtOldStyle.ReadOnly = True
        Me.txtOldStyle.Size = New System.Drawing.Size(232, 21)
        Me.txtOldStyle.TabIndex = 1
        '
        'Label2
        '
        Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label2.Location = New System.Drawing.Point(12, 40)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(56, 48)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "Change URL to:"
        '
        'Panel1
        '
        Me.Panel1.Controls.Add(Me.btnBrowse)
        Me.Panel1.Controls.Add(Me.Label3)
        Me.Panel1.Controls.Add(Me.txtNewStyle)
        Me.Panel1.Controls.Add(Me.rdoChange)
        Me.Panel1.Controls.Add(Me.rdoNone)
        Me.Panel1.Location = New System.Drawing.Point(74, 40)
        Me.Panel1.Name = "Panel1"
        Me.Panel1.Size = New System.Drawing.Size(345, 112)
        Me.Panel1.TabIndex = 3
        Me.Panel1.TabStop = True
        '
        'btnBrowse
        '
        Me.btnBrowse.Image = Global.MetaDoc.My.Resources.Resources.file_explore_16x16
        Me.btnBrowse.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnBrowse.Location = New System.Drawing.Point(261, 83)
        Me.btnBrowse.Name = "btnBrowse"
        Me.btnBrowse.Size = New System.Drawing.Size(75, 23)
        Me.btnBrowse.TabIndex = 4
        Me.btnBrowse.Text = "Browse"
        Me.btnBrowse.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        Me.btnBrowse.Visible = False
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(112, 32)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(192, 23)
        Me.Label3.TabIndex = 3
        Me.Label3.Text = "(no quote marks; should end in .xsl)"
        Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.Label3.Visible = False
        '
        'txtNewStyle
        '
        Me.txtNewStyle.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.txtNewStyle.Location = New System.Drawing.Point(26, 56)
        Me.txtNewStyle.Name = "txtNewStyle"
        Me.txtNewStyle.ScrollBars = System.Windows.Forms.ScrollBars.Horizontal
        Me.txtNewStyle.Size = New System.Drawing.Size(310, 21)
        Me.txtNewStyle.TabIndex = 2
        Me.txtNewStyle.Visible = False
        Me.txtNewStyle.WordWrap = False
        '
        'rdoChange
        '
        Me.rdoChange.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.rdoChange.Location = New System.Drawing.Point(8, 32)
        Me.rdoChange.Name = "rdoChange"
        Me.rdoChange.Size = New System.Drawing.Size(104, 24)
        Me.rdoChange.TabIndex = 1
        Me.rdoChange.TabStop = True
        Me.rdoChange.Text = "New URL"
        '
        'rdoNone
        '
        Me.rdoNone.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.rdoNone.Location = New System.Drawing.Point(8, 8)
        Me.rdoNone.Name = "rdoNone"
        Me.rdoNone.Size = New System.Drawing.Size(104, 24)
        Me.rdoNone.TabIndex = 0
        Me.rdoNone.TabStop = True
        Me.rdoNone.Text = "No stylesheet"
        '
        'OpenFileDialog1
        '
        Me.OpenFileDialog1.AddExtension = False
        Me.OpenFileDialog1.Filter = "Stylesheets (*.xsl)|*.xsl"
        Me.OpenFileDialog1.Title = "Browse for metadata stylesheet"
        '
        'btnOK
        '
        Me.btnOK.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnOK.Image = Global.MetaDoc.My.Resources.Resources.Ok_16x16
        Me.btnOK.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnOK.Location = New System.Drawing.Point(263, 158)
        Me.btnOK.Name = "btnOK"
        Me.btnOK.Size = New System.Drawing.Size(75, 23)
        Me.btnOK.TabIndex = 4
        Me.btnOK.Text = "OK"
        Me.btnOK.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'btnCancel
        '
        Me.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.btnCancel.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.btnCancel.Image = Global.MetaDoc.My.Resources.Resources.Cancel_16x16
        Me.btnCancel.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft
        Me.btnCancel.Location = New System.Drawing.Point(344, 158)
        Me.btnCancel.Name = "btnCancel"
        Me.btnCancel.Size = New System.Drawing.Size(75, 23)
        Me.btnCancel.TabIndex = 5
        Me.btnCancel.Text = "Cancel"
        Me.btnCancel.TextAlign = System.Drawing.ContentAlignment.MiddleRight
        '
        'ToolTip1
        '
        Me.ToolTip1.IsBalloon = True
        Me.ToolTip1.ShowAlways = True
        Me.ToolTip1.ToolTipIcon = System.Windows.Forms.ToolTipIcon.Info
        '
        'frmXMLchangeStyle
        '
        Me.AcceptButton = Me.btnOK
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.AutoScroll = True
        Me.CancelButton = Me.btnCancel
        Me.ClientSize = New System.Drawing.Size(440, 192)
        Me.ControlBox = False
        Me.Controls.Add(Me.btnCancel)
        Me.Controls.Add(Me.btnOK)
        Me.Controls.Add(Me.Panel1)
        Me.Controls.Add(Me.Label2)
        Me.Controls.Add(Me.txtOldStyle)
        Me.Controls.Add(Me.Label1)
        Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
        Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
        Me.Name = "frmXMLchangeStyle"
        Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
        Me.Text = "Modify XML Stylesheet"
        Me.Panel1.ResumeLayout(False)
        Me.Panel1.PerformLayout()
        Me.ResumeLayout(False)
        Me.PerformLayout()

    End Sub

#End Region

    Private Sub frmXMLchangeStyle_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        txtOldStyle.Text = strOldHref
    End Sub

    Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click
        If rdoNone.Checked = True Then
            strNewHref = ""
        ElseIf (rdoChange.Checked = True) Then
            If (Len(txtNewStyle.Text) > 0) Then
                strNewHref = "'" & txtNewStyle.Text & "'"
            Else
                strNewHref = ""
            End If
        Else
            strNewHref = strOldHref
        End If
        Me.Close()
    End Sub

    Private Sub btnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click
        strNewHref = strOldHref
        Me.Close()
    End Sub

    Private Sub rdoNone_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoNone.CheckedChanged
        Label3.Visible = False
        btnBrowse.Visible = False
        txtNewStyle.Visible = False
        txtNewStyle.Text = ""
    End Sub

    Private Sub rdoChange_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdoChange.CheckedChanged
        Label3.Visible = True
        btnBrowse.Visible = True
        txtNewStyle.Visible = True
        txtNewStyle.Focus()
    End Sub

    Private Sub btnBrowse_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnBrowse.Click
        Dim sFileName As String = ""
        If OpenFileDialog1.ShowDialog() = DialogResult.OK Then
            sFileName = OpenFileDialog1.FileName
            txtNewStyle.Text = sFileName
        End If

    End Sub
End Class
